import orm
from models import User, Blog, Comment
import asyncio
import sys

async def test():
    await orm.create_pool(loop=loop, user='root', password='wls.~!@#', db='awesome')

    u = User(name='Test2', email='test2@example.com', passwd='1234567890', image='about:blank')

    await u.save()


if __name__ == '__main__':

    # 获取EventLoop:
    loop = asyncio.get_event_loop()

    #把协程丢到EventLoop中执行
    loop.run_until_complete(test())  
    #关闭EventLoop
    loop.close()
    if loop.is_closed():
        sys.exit(0)


